/*
 *   Copyright(C) <2009>
 *
 *   <Sandeep K Sinha>
 *   <Rishi B Agrawal> <Vineet Agarwal> <Rohit K Sharma>
 *
 *   <sandeepksinha@gmail.com> <rishi.b.agrawal@gmail.com>
 *   <imreckless@gmail.com>
 *
 *   This program is free software: you can redistribute it and/or modify it
 *   under the terms of the GNU General Public License as published by the
 *   Free Software Foundation, either version 3 of the License, or(at your
 *   option) any later version->
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE->  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef _OHSM_U_H_
#define _OHSM_U_H_

#include <libxml/xmlmemory.h>
#include <libxml/parser.h>

#define DEBUG_DISP_SAM 1
#define DEBUG_DISP_INODES 2
#define DEBUG_DEMO 3

#define MINORBITS       20
#define MINORMASK      ((1U << MINORBITS) - 1)
#define MAJOR(dev)     ((dev) >> 8)
#define MINOR(dev)     ((dev) & 0xff)
#define MKDEV(ma, mi)   (((ma) << MINORBITS) | (mi))

#ifdef OHSM_DEBUG
#define ohsm_debug(f, a...) { \
      do { \
      fprintf(stderr, "\nOHSM-Debug (%s, %d) : %s :", \
                      __FILE__, __LINE__, __func__); \
      fprintf(stderr, f, ##a); \
      } while (0); \
}
#else
#define ohsm_debug(f, a...) /* Do nothing */
#endif

extern int ohsm_get_relocation_policy(char *);
extern int ohsm_get_allocation_policy(char *);
extern int ohsm_get_tier_device_info(char *);
extern int validate_tiers(xmlChar *, xmlNodePtr cur);
extern int validate_id(xmlChar *);
extern int validate_key(xmlChar *);
extern int validate_user(uid_t user);
extern int validate_group(gid_t group);
extern int ohsm_get_device_topology(char *);

struct ohsm_allocation_policy *allocpol;
struct ohsm_reloc_policy *relocpol;
struct ohsm_tier_dev_info *dev_info;
#endif
